﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;

namespace ProShoppingPen {
    public partial class FrmPenAbout : Form {
        public FrmPenAbout () {
            InitializeComponent( );
        }

        private string GetTheProVersion ( string fileName ) {
            string proVersion = "";
            string AutoUpdaterFileName = fileName;
            if (!File.Exists(AutoUpdaterFileName))
                return proVersion;
            //打开xml文档
            FileStream myFile = new FileStream(AutoUpdaterFileName, FileMode.Open);
            // xml文件阅读器
            XmlTextReader xml = new XmlTextReader(myFile);
            while (xml.Read( )) {
                if (xml.Name == "Version") {
                    // 获取升级文档的最后一次更新日期 
                    proVersion = xml.GetAttribute("Num");
                    break;
                }
            }
            xml.Close( );
            myFile.Close( );
            return proVersion;
        }

        private void btnOK_Click ( object sender, EventArgs e ) {
            this.Close( );
        }

        private void FrmPenAbout_Load ( object sender, EventArgs e ) {

            lblVersion.Text = "点读笔 " + GetTheProVersion("AutoUpdater.xml"); //程序当前版本号
        }
    }
}
